package com.gjzt.generator;

import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.ProgressCallback;
import org.mybatis.generator.codegen.mybatis3.IntrospectedTableMyBatis3Impl;
import org.mybatis.generator.internal.rules.FlatModelRules;
import org.mybatis.generator.internal.rules.Rules;

import java.util.List;

/**
 * Created by Administrator on 2016/3/17.
 */
public class BatisIntrospectedTableMyBatis3Impl  extends IntrospectedTableMyBatis3Impl {

    @Override
    public void calculateGenerators(List<String> warnings, ProgressCallback progressCallback) {
        Rules rule = getRules();
        if (rule instanceof FlatModelRules) {
            setRules(new MyRule(this));
        }
        super.calculateGenerators(warnings, progressCallback);
    }

    class MyRule extends FlatModelRules {
        /**
         * @param introspectedTable
         */
        public MyRule(IntrospectedTable introspectedTable) {
            super(introspectedTable);
        }

        @Override
        public boolean generateInsertSelective() {
            return false;
        }
    }
}